<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>日常点检业务</title>
    <link rel="Shortcut Icon" href="/static/Img/PageImg/Canva_small_pageIcon.png" sizes="36*36">
    <script type="text/javascript" src="/static/Js/jQuery-3.5.1.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/bootstrap-switch.min.js"></script>
    <script type="text/javascript" src="/static/Js/UserFullNameWaterMark.js"></script>
    <script type="text/javascript" src="/static/Js/watermark.js"></script>
    <script type="text/javascript" src="/static/Js/GetUserParam.js"></script>


    <link rel="stylesheet" href="/static/Css/bootstrap-switch.min.css">
    <link rel="stylesheet" href="/static/Css/CommonStyles.css">
    <style>
        .one{
            position: fixed;
            width: 60em;
            height: 3em;
            text-align: center;
            padding: 15px;
            margin-top: 10px;
            margin-left: 50%;

            transform: translate(-50%);
            background-color: rgba(255,255,255,.5);
            border: white 1px solid;
        }
        .two{
            position: fixed;
            width: 60em;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .cardText {
            background-color: white;
            margin-top: 1px;
            padding-right: 5px;
            padding-left: 5px;
            border: 1px gray solid;

            box-shadow: 0 3px 3px gray;
            border-radius: 25px;
        }
        .cardImg{
            margin-bottom: 5px;
            box-shadow: 0 3px 3px gray;
            border: 4px white solid;

        }
        .pointNameSelect{

            position: fixed;
            margin-top: -13px;
            margin-left: -25em;
            width: 11em;
            background-color: white;
            border: 1px white solid;
            border-radius: 12px;
            box-shadow: 0 3px 3px gray;
            padding-left: 5px;
            padding-right: 5px;
        }
        .pointTitle{
            position: fixed;
            margin-left: -29em;
            margin-top: -13px;
            background-color: white;
            border: 1px white solid;
            border-radius: 12px;
            box-shadow: 0 3px 3px gray;
            padding-left: 5px;
            padding-right: 5px;
        }
        .timeTitle {
            margin-left: -7em;
        }
        .s_c_time{
            margin-left: -3em;
        }
        .s_c_date{
            margin-left: 17em;
        }
        .context{
            margin-left: 0;
            position: fixed;
            margin-top: 4em;
            width: 50em;
            border-radius: 10px;
        }
        .statusPoint{
            border-radius: 50px;
            width: 20px;
            height: 20px;
            background-color: gray;
            position: absolute;
            margin-left: -3em;

        }
        .statusContext{
            position: absolute;
            width: 4em;
            margin-left: 1em;
            margin-top: -1px;
            visibility: inherit;
        }
        .statusPointProper{
            background-color: green;
            visibility: hidden;
        }
        .statusPointException{
            background-color: orange;
            visibility: hidden;

        }
        .statusPointBigException{
            background-color: red;
            visibility: hidden;

        }
        .tableSpan{
            position: absolute;
            max-height: 30em;
            margin-top: 4em;
            width: 50em;
            margin-left: -25em;
            background-color: white;
            padding-top: 1em;
            border-radius: 10px;
            visibility: hidden;
            overflow-y: auto;
        }
        .table{
            width: 50em;
        }
        .buttonSpan{
            position: absolute;

            width: 100%;
            margin-top: 37em;
            visibility: hidden;
        }
        .btn{
            margin-right: 0;
            float: none;
            width: auto;
            left: 50%;
            transform: translate(-50%,-50%);

        }
        #contextTBody>tr>td{
            max-width: 20em;
        }
        .startS_CModal{
            position: absolute;
            display: block;
            height: 40em;
            margin-top: -2em !important;
            width: 58em !important;
            max-width: none !important;
            visibility: hidden;
        }
        .modal-body{
            height: 28em;
        }
        .modal-dialog{
            max-width: none !important;
            width: 50em ;
        }
        .modalCloseBtn{
            left: 0;
            transform: none;
        }
        .modalSaveBtn{
            left: 0;
            transform: none;
        }
        .modalItemName{
            display: inline-block;
        }
        .modalFunAndBase{
            display: inline-block;
        }
        .modalItemImgAndStatus{
            display: block !important;
            height: 15em;
            width: 100%;
            margin-top: -1em;
            margin-bottom: -1em;

        }
        .S_CImg{
            display: inline-block !important;
            height: 17.5em;
            width: 50%;
            border-right: 1px gray solid;
        }
        .S_CStatus{
            height: 15em;
            display: inline-block !important;
            width: 50% ;
            position: absolute;
        }

        .modal-body>span {
            display: block;
            color: gray;
        }
        .modal-body>span>span {
            display: block;
            color: gray;
        }
        .itemName_modal{
            text-align: center;
            font-size: large;
            color: black !important;
        }
        hr{
            width:100%;
            color:#987cb9;
            SIZE:3px;
        }
        .S_CFun{
            border-right: 1px rgba(80,80,80,.5) solid;
            width: 50%;
            height: 100% !important ;
            display: inline-block !important;
        }
        .S_CBase{
            width: 50%;
            height: 100% !important;
            display: inline-block !important;
        }
        .modalFunAndBase{
            height: 5em;
            margin-top: -1em;
            margin-bottom: -1em;
            white-space: nowrap;
        }
        .S_CImgContext{
            width: 15em;
            height: 15em;
            display: block;
            margin-left: 20%;
            border-radius: 5px;
        }
        .custom-control{
            margin-left: 10em;
            margin-top: 2em;
        }
        .ExText{
            display: block;
            margin-left: 3em;
            width: 19em;
            margin-top: 1em;
        }
        .ExImgBtn{
            margin-top: 1em;
            margin-left:3em;
        }
        .path{
            width: 8em;
        }
        .ExDiv{
            visibility: hidden;
        }
        .errMessage{
            color: orange;
            margin-top: 0;
            text-align: center;
            visibility: hidden;
        }
        .modal-footer>button{
            left: 0!important;
            transform: none!important;
        }
        .S_CNext{
            visibility: hidden;
        }
        .S_CLast{
            visibility: hidden;
        }
        .S_CSave{
            visibility: hidden;
        }
        .progress-bar{
            width: 0%;
        }
        .pageErrMessage{
            position: absolute;
            right: 2em;
            height: 2em;
            margin-top: -10px;
            color: orange;
            font-weight: bolder;
        }


    </style>
</head>
<body  id="bg_body">
<div id="modalDiv"></div>
<div id="header"></div>

<div class="one itemName" style="position: absolute" id="one">
            <span  class="two" id="two">
                <span class="pointTitle">
                    点位:
                </span>
                <select onchange="getContext()" class="pointNameSelect"  name="pointName" id="pointName" >
                    <option style="display: none">

                    </option>
                </select>

                <span class="pointTitle timeTitle">
                    班次:
                </span>
                <select onchange="getSchedules()" class="pointNameSelect s_c_time"  name="s_c_time" id="s_c_time" >
                    <option id="mr">
                        早班
                    </option>
                    <option id="non">
                        中班
                    </option>
                </select>


                <input type="date" onchange="getS_CContextDate()" class="pointNameSelect s_c_date" name="s_c_date" id="s_c_date" >
                    <!--根据数据库自动布局-->
            </span>
            <span  class="tableSpan" id="context">
                <table class="table">
                  <thead>
                    <tr class="headTr">
                      <th scope="col">序号</th>
                      <th scope="col">点检项目</th>
                      <th scope="col">状态</th>
                      <th scope="col">点检人</th>
                    </tr>
                  </thead>
                  <tbody id="contextTBody">

                  </tbody>
                </table>
            </span>


</div>
            <span class="buttonSpan" id="buttonSpan">
                <button type="button" onclick="startS_CBtn()"  id="startS_CBtn" class="btn btn-primary">开始点检</button>
                <button type="button" id="onLoadS_CBtn" onclick="onLoadS_CBtn()" class="btn btn-success onLoadS_CBtn">提交审核</button>
                <span class="pageErrMessage" id="pageErrMessage"></span>
            </span>



<!-- data-toggle="modal" data-target="#exampleModal"-->

<!--modal-->


<!-- Modal -->
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal fade startS_CModal" id="exampleModal" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">  
                <h5 class="modal-title" id="exampleModalLabel">逐项点检</h5>
                <!--不允许使用‘X’按钮关闭-->
            </div>
            <div class="modal-body" id="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" onclick="S_CClose()">取消</button>
                <button type="button" onclick="S_CLast()" class="btn btn-primary S_CLast" id="S_CLast" >上一项</button>
                <button type="button" onclick="S_CNext()" class="btn btn-primary S_CNext" id="S_CNext">下一项</button>
                <button type="button" onclick="S_CSave()" class="btn btn-success S_CSave" id="S_CSave">点检完成</button>
            </div>
            <div>
                <div class="progress" style="height: 2px;">
                    <div class="progress-bar" id="progress-bar" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        getS_CContext()
        UserFullNameWaterMark()

    })
    function getPageUrl() {
        return window.location.pathname
    }
    /**导入头部
     * */
    $.get('/templates/HeadPage.html',function(data){
        $("#header").html(data)
    })
    /**导入消息提示
     * */
    $.get("/templates/Toasts.html",function (data){
        $("#ToastsPage").html(data)
    })
    /**导入错误提示
     * */
    $.get("/templates/CommonModal.html",function (data) {
        $("#modalDiv").html(data)
    })

    Date.prototype.format = function(format) {
        var date = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3),
            "S+": this.getMilliseconds()
        };
        if (/(y+)/i.test(format)) {
            format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
        }
        for (var k in date) {
            if (new RegExp("(" + k + ")").test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
            }
        }
        return format;
    }


    function getS_CContext() {
        $.post("/spot_check/getS_CPointName",{},function (result){
            if (result.flag){
                for (const resultElement of result.data) {
                    var html = '<option  value="'+resultElement.pointId+'">'
                        +resultElement.pointName
                        +'                     </option>';

                    $("#pointName").append(html)
                }
            }else {
                setErrModalMessage("提示",result.errorMsg)
            }

            //todo 2023/1/11 下次搞这！
        })
        let time = new Date()
        let hours = time.getHours()
        if (hours < 12) {
            document.getElementById("mr").setAttribute("selected","selected")
        }else {
            document.getElementById("non").setAttribute("selected","selected")
        }
        var t=new Date();
        t.setTime(t.getTime());
        document.getElementById("s_c_date").value = t.format("yyyy-MM-dd");



    }
    var S_COVERARR = []
    function getContext() {
        S_COVERARR = [];
        let pointName;
        let index;
        let pointNameValue;
        let date
        $("#contextTBody").empty()
        date = document.getElementById("s_c_date").value
        pointName = document.getElementById("pointName")
        index = pointName.selectedIndex
        pointNameValue = pointName.options[index].text


        $.post("/spot_check/getS_CContext",{pointName:pointNameValue,date:date},function (result) {
            if (result.flag) {


                let id = 0;
                document.getElementById("context").style.visibility = "visible";
                document.getElementById("buttonSpan").style.visibility= "visible";
                document.getElementById("onLoadS_CBtn").style.visibility = "hidden"
                let userParam = GetUserParam()

                for (const resultElement of result.data) {
                    S_COVERARR.push(resultElement)
                    console.log(S_COVERARR)
                    id++;
                    var html = '<tr>'
                        +'                       <th scope="row">'+id+'</th>'
                        +'                       <td id="itemName'+id+'">'+resultElement.pointContent+'</td>'
                        +'                       <td>'
                        +'                           <span class="statusPoint" id="notSC'+id+'"  ><span class="statusContext"  >未点检</span></span>'
                        +'                           <span class="statusPoint statusPointProper" id="okSC'+id+'" ><span class="statusContext">正常</span></span>'
                        +'                           <span class="statusPoint statusPointException" id="exSC'+id+'"><span class="statusContext">异常</span></span>'
                        +'                           <span class="statusPoint statusPointBigException" id="BigExSC'+id+'" ><span class="statusContext">重大异常</span></span>'
                        +'                       </td>'
                        +'                         <td>'+userParam.data.fullname+'</td>'
                        +'                     </tr>';
                    //todo 2023/1/18 下次搞这 拼table
                    $("#contextTBody").append(html)
                }
                S_CSave()

            }
        })


    }
    var stepLength = 0;
    var step1 = "";
    function getSchedules() {
        getContext();
    }
    function getS_CContextDate(id) {
        getContext()
    }

    function startS_CBtn() {
        $("#modal-body").empty()
        document.getElementById("exampleModal").style.visibility = "visible"
        $("#exampleModal").modal("show");
        $("#startS_CBtn").text("正在点检");
        getS_CContextItems();
    }
    var arrIndex = 0;
    var htmlArr = [];
    var htmlArrLength=0;
    function getS_CContextItems() {
        let pointName = document.getElementById("pointName")
        let index = pointName.selectedIndex
        let pointNameValue = pointName.options[index].text

        /**初始化*/
        arrIndex = 0;
        htmlArr = [];
        htmlArrLength=0;

        stepLength = 0;
        step1 = "";
        htmlArrLength=0;


        $.ajax({
            url:"/spot_check/getS_CContextItems",
            type:"POST",
            dataType:"json",
            data:{pointName:pointNameValue},

            success:function (results){
                for (const result of results) {
                    htmlArr.push(result)
                }
            },
            complete:function (){
                htmlArrLength = htmlArr.length;
                console.log(htmlArr.length)
                let length = htmlArrLength  ;
                stepLength = (100 / length )
                console.log(length)
                step1 = Math.round(step1 + stepLength) ;
                console.log(step1)
                $("#progress-bar").css("width",step1+"%")
                setS_CHtmlArr()

            }
        })



    }


    /**渲染modal*/
    function setS_CHtmlArr() {
        console.log(htmlArrLength)
        if (arrIndex === 0 || htmlArrLength > 1) {
            document.getElementById("S_CNext").style.visibility = "visible"
        }
        if (arrIndex === 0) {
            document.getElementById("S_CLast").style.visibility = "hidden"
        }
        if (arrIndex > 0) {
            document.getElementById("S_CLast").style.visibility = "visible"
        }
        if (arrIndex === htmlArrLength-1){
            document.getElementById("S_CNext").style.visibility = "hidden"
            document.getElementById("S_CSave").style.visibility = "visible"
        }else {
            document.getElementById("S_CSave").style.visibility = "hidden"
        }
        if (arrIndex < htmlArrLength) {
            let imgPath;


        let htmlContext = htmlArr[arrIndex]
            console.log(S_COVERARR)
            let staticTempPath = "/Spot_check/TempImage/"
            if (htmlContext.pointContentStandard === null){
                imgPath = "/static/Img/PageImg/canva.png"
            }else {
                imgPath = staticTempPath+htmlContext.pointContentStandard
            }


            var html = '<span class="modalItemName" id="modalItemName">'
                +'                     <span class="S_CItemTitle" id="S_CItemTitle">点检项：</span>'
                +'                     <span class="itemName_modal" id="itemName_modal">'+htmlContext.pointContent+'</span>'
                +'                 </span>'
                +'                 <hr>'
                +'                 <span class="modalFunAndBase" id="modalFunAndBase">'
                +'                     <span class="S_CFun" id="S_CFun">'
                +'                         <span class="S_CFunTitle" id="S_CFunTitle">点检方法：</span>'
                +'                         <span class="S_CFunText" id="S_CFunText">'+htmlContext.scFun+'</span>'
                +'                     </span>'
                +'                     <span class="S_CBase" id="S_CBase">'
                +'                         <span class="S_CBaseTitle" id="S_CBaseTitle">点检基准：</span>'
                +'                         <span class="S_CBaseText" id="S_CBaseText">'+htmlContext.scBenchmark+'</span>'
                +'                     </span>'
                +'                 </span>'
                +'                 <hr>'
                +'                 <span class="modalItemImgAndStatus" id="modalItemImgAndStatus">'
                +'                     <span class="S_CImg">'
                +'                         <span class="S_CImgTitle" id="S_CImgTitle">标准图片：</span>'
                +'                         <img class="S_CImgContext" src="'+imgPath+'">'
                +'                     </span>'
                +'                     <span class="S_CStatus" id="S_CStatus">'
                +'                         <span class="S_CStatusTitle" id="S_CStatusTitle">状态判定：</span>'
                +'                         <div class="custom-control custom-switch S_CStatusOKBtn" >'
                +'                           <input type="checkbox" value="1" class="custom-control-input" id="customSwitchOK" onclick="SetStatus(this)">'
                +'                           <label class="custom-control-label" for="customSwitchOK">正常</label>'
                +'                         </div>'
                +'                         <div class="custom-control custom-switch S_CStatusEXBtn ">'
                +'                           <input type="checkbox" value="2" class="custom-control-input" id="customSwitchEX" onclick="SetStatus(this)">'
                +'                           <label class="custom-control-label" for="customSwitchEX">异常</label>'
                +'                         </div>'
                +'                         <div class="custom-control custom-switch S_CStatusEXBtn ">'
                +'                           <input type="checkbox" value="3" class="custom-control-input" id="customSwitchBigEX" onclick="SetStatus(this)">'
                +'                           <label class="custom-control-label" for="customSwitchBigEX">重大异常</label>'
                +'                         </div>'
                +'                         <!--异常现象-->'
                +'                         <div class="ExDiv" id="ExDiv">'
                +'                             <input class="ExText" onblur="ExTextIsNull(this)" placeholder="异常描述" id="ExText" type="text">'
                +'                             <span class="ExText errMessage"  id="errMessage">异常描述不能为空！</span>'
                /**太麻烦了，有时间再搞*/
                /*+'                             <span>'
                +'                                 <input type="button" class="ExImgBtn" id="ExImgBtn" value="请选择描述图片(非必选)" onclick="'+jQuery('#ExImg').click()+'">'
            +'                                 <input type="text" class="path" placeholder="文件路径" readonly name="path" id="path">'
            +'                                 <input type="file"  onchange="'+jQuery('#path').val(jQuery('#ExImg').val())+'" id="ExImg" style="display: none" value="请选择描述图片(非必选)">'
            +'                             </span>'*/
            +'                         </div>'
            +'                 </span>'
            +'                 </span>';

            $("#modal-body").append(html)
            let val = document.getElementById("itemName_modal").innerText
            setS_CStatus(val)
        }
    }

    function SetStatus(obj) {

        let id = obj.id
        let arr_customSwitch = $("[id^='customSwitch']")
        if ($(obj).is(":checked") === true) {
            let S_CValue = document.getElementById(id).getAttribute("value")
            let text = document.getElementById("itemName_modal").innerText
            let exText = document.getElementById("ExText").value
            let user = GetUserParam()
            let sc_time = document.getElementById("s_c_time")
            let index = sc_time.selectedIndex
            let time = sc_time.options[index].text

            for (const overArr of S_COVERARR) {
                if (overArr.pointContent === text) {
                    if (time === "早班") {
                        overArr.pointContentMorningStatusId = parseInt(S_CValue)
                        overArr.pointContentMorningUid = user.data.uid
                        if (overArr.pointContentMorningStatusId !== null) {
                            let statusId = overArr.pointContentMorningStatusId
                            setS_CStatus(statusId)
                        }
                    } else {
                        overArr.pointContentMiddayStatusId = parseInt(S_CValue)
                        overArr.pointContentMiddayUid = user.data.uid
                        if (overArr.pointContentMiddayStatusId !== null) {
                            let statusId = overArr.pointContentMiddayStatusId
                            console.log(statusId)
                            setS_CStatus(statusId)
                        }
                    }
                }
            }
            console.log(S_COVERARR)
            if (id !== "customSwitchOK") {
                document.getElementById("ExDiv").style.visibility = "visible"
                document.getElementById("ExText").focus()


            } else {
                document.getElementById("errMessage").style.visibility = "hidden"
                document.getElementById("ExDiv").style.visibility = "hidden"

            }
            for (const arrCustomSwitch of arr_customSwitch) {

                if (arrCustomSwitch.id !== id) {
                    document.getElementById(arrCustomSwitch.id).setAttribute("disabled", "")
                    document.getElementById(arrCustomSwitch.id).removeAttribute("checked")
                }

            }
        } else {
            document.getElementById("ExDiv").style.visibility = "hidden"
            document.getElementById("errMessage").style.visibility = "hidden"
            for (const arrCustomSwitch of arr_customSwitch) {

                document.getElementById(arrCustomSwitch.id).removeAttribute("disabled")
            }
        }
    }

        function S_CNext() {
            $("#modal-body").empty()
            step1 = Math.round(step1 + stepLength);
            console.log(step1)
            $("#progress-bar").css("width", step1 + "%")
            arrIndex++;
            setS_CHtmlArr()
            let val = document.getElementById("itemName_modal").innerText
            setS_CStatus(val)

        }

        function S_CLast() {
            $("#modal-body").empty()
            if (arrIndex > 0 || arrIndex !== 0) {
                arrIndex--;
                console.log(step1)
                step1 = Math.round(step1 - stepLength);

                $("#progress-bar").css("width", step1 + "%")
                setS_CHtmlArr()
                let val = document.getElementById("itemName_modal").innerText
                setS_CStatus(val)
            }
        }

        function ExTextIsNull(obj) {
            let text = document.getElementById(obj.id).value
            let itemName = document.getElementById("itemName_modal").innerText

            let sc_time = document.getElementById("s_c_time")
            let index = sc_time.selectedIndex
            let time = sc_time.options[index].text

            if (text === null || text === "") {
                document.getElementById("errMessage").style.visibility = "visible"
                document.getElementById("ExText").focus()
            } else {
                document.getElementById("errMessage").style.visibility = "hidden"

                for (const sc of S_COVERARR) {
                    if (sc.pointContent === itemName) {
                        if (time === "早班") {
                            sc.morningEXDescription = text
                        } else {
                            sc.middayEXDescription = text
                        }
                    }
                }
            }
        }

        function S_CClose() {
            $("#modal-body").empty()
            $("#exampleModal").modal("hide")
            $("#startS_CBtn").text("开始点检");

        }

        function S_CSave() {
            let id = 0;
            let sc_time = document.getElementById("s_c_time")
            let index = sc_time.selectedIndex
            let time = sc_time.options[index].text
            for (const scoverarrElement of S_COVERARR) {
                id++;
                console.log(id)
                let itemName = document.getElementById("itemName" + id).innerText
                if (itemName === scoverarrElement.pointContent) {
                    if (time === "早班") {
                        if (scoverarrElement.pointContentMorningStatusId === 1) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("okSC" + id).style.visibility = "visible"
                            document.getElementById("exSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "hidden"
                           /* document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else if (scoverarrElement.pointContentMorningStatusId === 2) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("exSC" + id).style.visibility = "visible"
                            document.getElementById("okSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "hidden"
                         /*   document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else if (scoverarrElement.pointContentMorningStatusId === 3) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("exSC" + id).style.visibility = "hidden"
                            document.getElementById("okSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "visible"
                          /*  document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else {
                            document.getElementById("pageErrMessage").style.visibility = "visible"
                            $("#pageErrMessage").text("您有未完成的点检,请检查!")
                            document.getElementById("startS_CBtn").style.visibility = "visible"
                            document.getElementById("onLoadS_CBtn").style.visibility = "hidden"
                        }
                    }else {
                        if (scoverarrElement.pointContentMiddayStatusId === 1) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("okSC" + id).style.visibility = "visible"
                            document.getElementById("exSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "hidden"
                            /*document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else if (scoverarrElement.pointContentMiddayStatusId === 2) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("exSC" + id).style.visibility = "visible"
                            document.getElementById("okSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "hidden"
                            /*document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else if (scoverarrElement.pointContentMiddayStatusId === 3) {
                            document.getElementById("notSC" + id).style.visibility = "hidden"
                            document.getElementById("exSC" + id).style.visibility = "hidden"
                            document.getElementById("okSC" + id).style.visibility = "hidden"
                            document.getElementById("BigExSC" + id).style.visibility = "visible"
                           /* document.getElementById("startS_CBtn").style.visibility = "hidden"*/
                            document.getElementById("onLoadS_CBtn").style.visibility = "visible"
                            document.getElementById("pageErrMessage").style.visibility = "hidden"
                            $("#exampleModal").modal("hide")
                        } else {
                            document.getElementById("pageErrMessage").style.visibility = "visible"
                            $("#pageErrMessage").text("您有未完成的点检,请检查!")
                            document.getElementById("startS_CBtn").style.visibility = "visible"
                            document.getElementById("onLoadS_CBtn").style.visibility = "hidden"
                        }
                    }

                }

            }

        }

        function setS_CStatus(itemName) {
            let statusId;
            let ExText;
            let sc_time = document.getElementById("s_c_time")
            let index = sc_time.selectedIndex
            let time = sc_time.options[index].text
            for (const scoverarrElement of S_COVERARR) {
                if (scoverarrElement.pointContent === itemName) {
                    if (time === "早班") {
                        statusId = scoverarrElement.pointContentMorningStatusId
                        ExText = scoverarrElement.morningEXDescription
                    } else {
                        statusId = scoverarrElement.pointContentMiddayStatusId
                        ExText = scoverarrElement.middayEXDescription
                    }
                }
            }
            console.log("aaaaa" + statusId)

            if (statusId === 1) {
                /*正常*/
                $("#customSwitchOK").prop("checked", true)
            }
            if (statusId === 2) {
                /*异常*/
                $("#customSwitchEX").prop("checked", true)
                document.getElementById("ExText").style.visibility = "visible"
                $("#ExText").val(ExText)
            }
            if (statusId === 3) {
                /*重大异常*/
                $("#customSwitchBigEX").prop("checked", true)
                document.getElementById("ExText").style.visibility = "visible"
                $("#ExText").val(ExText)
            }

        }

        function onLoadS_CBtn() {
            /*$.post("/spot_check/saveSCDailyContext",{s_c_datesEntity:JSON.stringify(S_COVERARR)},function (result) {

        })*/
            $.ajax({
                url: "/spot_check/saveSCDailyContext",
                type: "POST",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify(S_COVERARR),
                success: function (result) {
                    if (!result.flag){
                        $("#message_Div").empty()
                        let message = "刚刚";
                        var html = '<div class="toast" role="alert"  data-delay="5000" aria-live="assertive" aria-atomic="true" >'
                            + '       <div class="toast-header">'
                            + '         <img height="25px" width="25px" src="/static/Img/PageImg/Canva_small.png" class="rounded mr-2" alt="">'
                            + '         <strong class="mr-auto" >系统提示</strong>'
                            + '          &nbsp;&nbsp;&nbsp;&nbsp;'
                            + '         <small class="text-muted">' + message + '</small>'
                            + '         <button type="button" class="ml-2 mb-1 close" onclick="deleteToast()" data-dismiss="toast" aria-label="Close">'
                            + '           <span aria-hidden="true">&times;</span>'
                            + '         </button>'
                            + '       </div>'
                            + '       <div class="toast-body">'
                            + '          &nbsp;&nbsp;&nbsp;&nbsp;'
                            + ''+result.errorMsg+''
                            + '          &nbsp;&nbsp;&nbsp;&nbsp;'
                            + '       </div>'
                            + '     </div>';
                        $("#message_Div").append(html)
                        $('.toast').toast("show")
                    }else {
                        window.location.href = "Spot_Check_Daily.html"
                    }

                }
            })
        }

        function tableInit() {

        }


</script>
</body>
</html>


<!--let staticTempPath = "/Spot_check/TempImage/"
                    for (const resultElement of result) {
                        let imgSrc;
                        if (resultElement.imageName === "null.jpeg") {
                            imgSrc = "/Spot_check/SysImg/ImgNull.png"-->